import os
import re

folderA_path = "/home/champrin/Downloads/23年数据集/分区赛/rock/remove/home/label"

for filename in os.listdir(folderA_path):
    if re.match(r'frame(\d+)\.txt', filename):
        # 提取文件名中的数字
        match = re.match(r'frame(\d+)\.txt', filename)
        if match:
            number = match.group(1)
            new_filename = f"H-BLUE-{number}.txt"

            # 构建旧文件路径和新文件路径
            old_file_path = os.path.join(folderA_path, filename)
            new_file_path = os.path.join(folderA_path, new_filename)

            # 重命名文件
            os.rename(old_file_path, new_file_path)
            print(f"Renamed {filename} to {new_filename}")

print("Renaming process completed.")